home *** CD-ROM | disk | FTP | other *** search
/ Flybox Trout (Edition 1) / Flybox Trout (Edition 1).iso / Setup / Support / FlyBox.exe / FlyBox.dxr / 00018_DownloadAnecdotes.ls < prev    next >
Encoding:
Text File  |  2002-04-15  |  1.7 KB  |  49 lines

  1. property theNetID, RecNo
  2. global DBPath
  3.  
  4. on exitFrame me
  5.   db = DGOpenDatabase(DBPath & "FlyBox.mdb", 0, 0, ";PWD=StopLooking")
  6.   Password = getVariable(sprite(1), "Password")
  7.   theResult = EMPTY
  8.   if voidp(theNetID) or (theNetID = 0) then
  9.     theNetID = getNetText("http://www.flybox.info/download.asp?password=" & Password)
  10.   end if
  11.   if netDone(theNetID) then
  12.     theResult = netTextresult(theNetID)
  13.     if theResult = "x" then
  14.       setVariable(sprite(1), "Finished", "T")
  15.       go("Finished")
  16.       RecNo = 0
  17.     else
  18.       if theResult = EMPTY then
  19.         alert("There has been a problem contacting the Flybox web-site. Please ensure that:" & RETURN & RETURN & "1. You are connected to the Internet." & RETURN & "2. If you are behind a firewall that you have permissions to access the Internet.")
  20.         setVariable(sprite(1), "Finished", "T")
  21.         go("Finished")
  22.         RecNo = 0
  23.       else
  24.         if (ilk(value(theResult)) = #list) or (ilk(value(theResult)) = #propList) then
  25.         end if
  26.         cont = 1
  27.         repeat while theResult <> EMPTY
  28.           EndC = offset("]", theResult)
  29.           StartC = offset("[", theResult)
  30.           x = chars(theResult, 2, EndC - 1)
  31.           strLen = theResult.char.count
  32.           theResult = chars(theResult, EndC + 2, strLen)
  33.           RecNo = RecNo + 1
  34.           setVariable(sprite(1), "Anecdote:DownloadingText", "Adding record " & RecNo)
  35.           DGExecute("INSERT INTO Anecdote (Author, EMail, FlyID, Anecdote, UserAnecdote) VALUES (" & x & ", 0)", db)
  36.           if not voidp(GetLastDGError()) then
  37.             ClearDGError()
  38.           end if
  39.         end repeat
  40.       end if
  41.     end if
  42.     theNetID = VOID
  43.     go(the frame)
  44.   else
  45.     go(the frame)
  46.   end if
  47.   DGClose(db)
  48. end
  49.